package com.example.nettydemo.server;

import com.example.nettydemo.handle.NettyClientPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author Administrator
 * @since 2019-07-05 15:55
 */
public class NettyClientPoolTest {

    public static void main(String[] args) throws InterruptedException {

        ExecutorService singleThreadExecutor;
        singleThreadExecutor = Executors.newSingleThreadExecutor();

        NettyClientPool clientPool = new NettyClientPool("localhost",9888);

        //
        clientPool.send(1);

        // for (int i = 0; i < 15; i++) {
        //     int finalI = i;
        //     System.out.println("i = " + i);
        //     singleThreadExecutor.submit(new Runnable() {
        //         @Override
        //         public void run() {
        //             try {
        //                 System.out.println("finalI = " + finalI);
        //                 clientPool.send(finalI);
        //             } catch (InterruptedException e) {
        //                 e.printStackTrace();
        //             }
        //         }
        //     });
        // }
        try {
            Thread.sleep(30000);
            System.exit(0);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}